import java.math.BigDecimal;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请选择还款方式，1：等额本息，2：等额本金");
        int method = scanner.nextInt();
        System.out.println("请输入贷款总额：");
        double loanMoney = scanner.nextDouble();
        System.out.println("请输入年利率：");
        double yearRate = scanner.nextDouble();
        System.out.println("请输入还款月数：");
        int totalMonth = scanner.nextInt();
        switch (method){
            case 1:
                AverageCapitalPlusInterest averageCapitalPlusInterest = new AverageCapitalPlusInterest(BigDecimal.valueOf(loanMoney),BigDecimal.valueOf(yearRate),totalMonth);
                averageCapitalPlusInterest.calculate();
                break;
            case 2:
                AverageCapital averageCapital = new AverageCapital(BigDecimal.valueOf(loanMoney),BigDecimal.valueOf(yearRate),totalMonth);
                averageCapital.calculate();
                break;
        }
    }
}
